<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'Showterm.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<style type="text/css">
	a{
		text-decoration: none;
	}
	
	</style>
	<script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
	<script type="text/javascript">
			function showcourse(e){
				var e=e||event;
				var a=e.srcElement||e.Target;
				var tr=a.parentNode.parentNode;
				var table = document.getElementById("table");
				var row = table.insertRow(tr.rowIndex+1);
				var cell = row.insertCell(0);
				cell.colSpan = "4";
			
				var termid=a.getAttribute("termid");
				
				$.ajax({
					type:"post",
					url:"./course/showtermandprofession!showcourse.action",
					data:{termid:termid,n:Math.random()},
					success:function(html){
						cell.innerHTML = html;
					}					
				});
				}
	</script>
  </head>
  
  <body>
  <table border="1" width="500px;" height="100px;" id="table">
  	<tr>
  		<td colspan="3" align="center">学期</td>
  	</tr>
  <s:iterator value="list" var="list">
  	<tr>
  		<td align="center"><s:property value="#list.name"/></td>
  		<td align="center"><a showStatus="false" href="javascript:void(0);" termid="<s:property value='#list.id'/>" onclick="showcourse(event)">详情</a></td>
  	</tr>
  </s:iterator>
  	  </table>
  </body>
</html>
